package domain.model.project.support;

import domain.model.project.*;
import domain.model.project.support.projectid.ProjectIdBuilder;
import shared.model.BuilderObject;

/**
 * @author Gregory Boissinot
 */
public class ProjectBuilder implements BuilderObject<Project> {

    private RWProject project;

    public ProjectBuilder(String org, String name, String status) {
        final ProjectId projectId = new ProjectIdBuilder(org, name).build();
        this.project = new ProjectImpl(projectId, ProjectStatus.get(status));
    }

    public ProjectBuilder(String org, String name, ProjectStatus projectStatus) {
        final ProjectId projectId = new ProjectIdBuilder(org, name).build();
        this.project = new ProjectImpl(projectId, projectStatus);
    }

    public ProjectBuilder projectSCM(ProjectSCM projectSCM) {
        this.project.setProjectSCM(projectSCM);
        return this;
    }

    public ProjectBuilder description(String description) {
        this.project.setDescription(description);
        return this;
    }

    public ProjectBuilder templateLocalFilePath(String templateLocalFilePath) {
        this.project.setTemplateLocalFilePath(templateLocalFilePath);
        return this;
    }

    public ProjectBuilder projectType(ProjectType projectType) {
        this.project.setProjectType(projectType);
        return this;
    }

    @Override
    public Project build() {
        return this.project;
    }
}
